<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="utf-8" />
		<title>个人信息</title>
		<link rel="stylesheet" type="text/css" href="css/public.css"/>
		<link rel="stylesheet" type="text/css" href="css/mygrxx.css" />
	</head>
	<body>
		<!------------------------------head------------------------------>
		<div th:replace="headbing.html"></div>
		<!------------------------------idea------------------------------>
		<div class="address mt">
			<div class="wrapper clearfix">
				<a href="index.html" class="fl">首页</a>
				<span>/</span>
				<a onclick="javaScript:personal()" class="on">个人信息</a>
			</div>
		</div>
		
		<!------------------------------Bott------------------------------>
		<div class="Bott">
			<div class="wrapper clearfix">
				<div th:replace="bott.html"></div>
				<div class="you fl">
					<h2>修改密码</h2>
					<form action="#" method="get" class="remima">
						<p id="mima" style="display: none"><th:paaw th:text="${session.paaw}"/></p>
						<p id="sid" style="display: none"><th:userid th:text="${session.userid}"/></p>
						<p><span>原密码：</span><input id="ymm" type="password"/></p>
						<p class="op">输入原密码</p>
						<p><span>新密码：</span><input id="xmm" type="password" /></p>
						<p class="op">以字母开头，长度在6~18之间，只能包含字符、数字和下划线</p>
						<p><span>重复新密码：</span><input id="xmm2" type="password" /></p>
						<p class="op">请再次输入密码</p>
						<input type="button" onclick="bull()" value="提交" />
					</form>
				</div>
			</div>
		</div>
		
		<!--返回顶部-->
		<div th:replace="gotop.html"></div>
		<!--footer-->
		<div class="footer">
			<div class="top">
				<div class="wrapper">
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot1.png"/></a>
						<span class="fl">7天无理由退货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot2.png"/></a>
						<span class="fl">15天免费换货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot3.png"/></a>
						<span class="fl">满599包邮</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="img/foot4.png"/></a>
						<span class="fl">手机特色服务</span>
					</div>
				</div>
			</div>
			<p class="dibu">最家家居&copy;2013-2017公司版权所有 京ICP备080100-44备0000111000号<br />
			违法和不良信息举报电话：400-800-8200，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</p>
		</div>
		<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/user.js" type="text/javascript" charset="utf-8"></script>
	<script>
		function bull() {
			var paw1=$("#mima").text();
			var id=$("#sid").text();
			var ymm=$("#ymm").val();
			var xmm=$("#xmm").val();
			var xmm2=$("#xmm2").val();
			var passs=/^[a-zA-Z]\w{5,17}$/;
			if (ymm!=paw1){
				alert("原密码错误")
				return false;
			}
			if (xmm!=xmm2){
				alert("两次密码不一致")
				return false;
			}
			if (xmm==""||xmm==null){
				alert("密码不能为空")
				return false;
			}
			if (passs.test(xmm)==false) {
				alert("以字母开头，长度在6~18之间，只能包含字符、数字和下划线")
				return false;
			}
			$.ajax({
				url:"http://localhost:8080/quit2",
				data:{
				"id":id,
				"xmm":xmm
				},
				success:function (resp) {
					if (resp.success){
						var count=resp.data;
						if (count>0){
							alert("修改成功,请重新登录");
							location.href = "http://localhost:8080/quit";
						}
					}else {

					}

				},
			})
		}
	</script>
	</body>
</html>
